package com.yhyvr.api.controller.comment;

import com.yhyvr.api.handle.ApiData;
import com.yhyvr.api.service.store.ApiCommentService;
import com.yhyvr.api.tool.ViewFactory;
import com.yhyvr.pojo.req.api.ApiReqData;
import com.yhyvr.pojo.req.api.store.comment.ApiCommentsAddReq;
import com.yhyvr.pojo.req.api.store.comment.ApiGoodsCommentReq;
import com.yhyvr.pojo.req.api.store.order.ApiOrderInfoReq;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * 评论
 * Created by Administrator on 2017/6/22.
 */
@Controller
public class ApiCommentController {
    @Resource
    private ApiCommentService apiCommentService;
    @RequestMapping("/api/store/comment/add")
    public @ResponseBody
    ModelAndView addComment (@ApiData(h5Visit=true) ApiReqData<ApiCommentsAddReq> apiReqBodyApiReqData){
        return ViewFactory.buildApiJsonpView(apiCommentService.addComment(apiReqBodyApiReqData),apiReqBodyApiReqData.getCrossDomain());
    }
    @RequestMapping("/api/store/comment/goods")
    public @ResponseBody
    ModelAndView commentGoods (@ApiData(h5Visit=true) ApiReqData<ApiOrderInfoReq> apiReqBodyApiReqData){
        return ViewFactory.buildApiJsonpView(apiCommentService.commentGoods(apiReqBodyApiReqData),apiReqBodyApiReqData.getCrossDomain());
    }

    @RequestMapping("/api/store/comment/list")
    public @ResponseBody
    ModelAndView commentList (@ApiData(h5Visit=true) ApiReqData<ApiGoodsCommentReq> apiReqBodyApiReqData){
        return ViewFactory.buildApiJsonpView(apiCommentService.commentList(apiReqBodyApiReqData),apiReqBodyApiReqData.getCrossDomain());
    }
}
